import {tVisualEditorActionConfig} from "../../packages/createVisualEditorUser/createVisualEditorAction/createVisualEditorActionConfig";
import {PlFormItem, PlInput} from "plain-design";
import {PickProduct} from "../../components/PickProduct";
import {PickCategory} from "../../components/PickCategory";

/**
 * 预定义动作配置
 * @author  韦胜健
 * @date    2022/2/6 23:36
 */
export function predefineActionConfig({ config: { registryActionConfig } }: { config: tVisualEditorActionConfig }) {

  registryActionConfig('@@fixed', {
    name: '固定地址',
    renderConfig: actionData => {
      return (
        <PlFormItem label="固定链接">
          <PlInput v-model={actionData.data}/>
        </PlFormItem>
      );
    }
  });

  registryActionConfig('pdp', {
    name: '跳转商品',
    renderConfig: actionData => {
      return (
        <PlFormItem label="选择商品">
          <PickProduct v-model={actionData.data}/>
        </PlFormItem>
      );
    }
  });

  registryActionConfig('category', {
    name: '跳转分类',
    renderConfig: actionData => {
      return (
        <PlFormItem label="选择分类">
          <PickCategory v-model={actionData.data}/>
        </PlFormItem>
      );
    }
  });

  registryActionConfig('bind-product', {
    name: '跳转绑定商品',
    renderConfig: () => null,
  });

}

